﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using IDAL;

namespace DALFactory
{
    public class DateAccess
    {
        private static string AssemblyName = ConfigurationManager.AppSettings["Path"].ToString();
        private static string db = ConfigurationManager.AppSettings["dbType"].ToString();

        public static IusersDAL GetusersDAL()
        {
            string className = AssemblyName + "." + db + "usersDAL";
            IusersDAL test = (IusersDAL)Assembly.Load(AssemblyName).CreateInstance(className);
            return test;
        }
        public static IgameAccountDAL GetgameAccountDAL()
        {
            string className = AssemblyName + "." + db + "gameAccountDAL";
            return (IgameAccountDAL)Assembly.Load(AssemblyName).CreateInstance(className);
        }
        public static IgoodsDAL GetIgoodsDAL()
        {
            string className = AssemblyName + "." + db + "goodsDAL";
            return (IgoodsDAL)Assembly.Load(AssemblyName).CreateInstance(className);
        }
        public static IordersDAL GetIordersDAL()
        {
            string className = AssemblyName + "." + db + "ordersDAL";
            return (IordersDAL)Assembly.Load(AssemblyName).CreateInstance(className);
        }
        public static IorderDetailDAL GetIorderDetailDAL()
        {
            string className = AssemblyName + "." + db + "orderDetailDAL";
            return (IorderDetailDAL)Assembly.Load(AssemblyName).CreateInstance(className);
        }
        public static IshopCarDAL GetIshopCarDAL()
        {
            string className = AssemblyName + "." + db + "shopCarDAL";
            return (IshopCarDAL)Assembly.Load(AssemblyName).CreateInstance(className);
        }
        public static IgoodCommentDAL GetIgoodCommentDAL()
        {
            string className = AssemblyName + "." + db + "goodCommentDAL";
            return (IgoodCommentDAL)Assembly.Load(AssemblyName).CreateInstance(className);
        }
    }
}
